program MaxDaC;

var
   x : array[1..10] of integer;

function max(l, r : integer) : integer;
begin
   if l = r then 
      max := x[l]
   else
   begin
      if max(l, l+(r-l) div 2) > max(l+(r-l) div 2 + 1, r) then
	 max := max(l, l+(r-l) div 2)
      else
	 max := max(l+(r-l) div 2 + 1,r);
   end;
end;

begin 
   x[1] := 1; x[2] := 9; x[3] := 2; x[4] := 3; x[5] := 4; x[6] := 5; x[7] := 5; x[8] := 9; x[9] := 6; x[10] := 1;
   Writeln(max(1,10));
end.
